package lab03.test01.test04;

import java.io.*;

/**
 * Created by Adminitrator on 2017/12/12.
 */

    public class Test{
    public static void main(String[] args) {
        String source = "D:\\source\\high.mp3";
        String target = "D:\\target\\";
        BufferedReader reader = null;
        BufferedWriter writer = null;
        try {
            reader = new BufferedReader(new FileReader(source));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        File file = new File(target);
        if (!file.exists()) file.mkdir();
        try {
            writer = new BufferedWriter(new FileWriter(target));
        } catch (IOException e) {
            e.printStackTrace();
        }
        try {
            writer.write(reader.read());
        } catch (IOException e) {
            e.printStackTrace();
        }
        finally {
            try {
                reader.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        for (File f : file.listFiles()) {
            if (f.isFile()) {
                System.out.println("文件：" + f.getName());
            }
        }
}
    }
